Color image sensors (e.g., color films, digital cameras using CCD or CMOS sensors, or the like) generally sense light intensities in a finite number of distinct spectral components. Various types of color image sensors differ in how they separate and measure the distinct spectral components. For example, digital cameras or other man-made color image sensor arrangements generally use a spatial color filter array (CFA), e.g., a Bayer color filter array, positioned over an image sensor to capture different spectral components of light in corresponding nominal pixel types.
A three-color CFA is used in many digital image sensors. A Bayer filter mosaic is a CFA for arranging red (R), green (G) and blue (B) color filters on a square grid of photosensors. The filter pattern is typically 50% green, 25% red and 25% blue. A CFA comprises a mosaic of color filters in front of an image sensor. For example, the image sensor comprises an array of pixel sensors, and the CFA comprises an array of color filters, such that each filter of the CFA is overlaid over a corresponding pixel sensor of the image sensor. A typical CFA comprises alternating red (R) and green (G) filters for odd rows, and alternating green (G) and blue (B) filters for even rows (although any other different arrangement of the R, G and B filters may also be possible), with each filter being overlaid over a corresponding pixel of the image sensor.
Since each pixel of the image sensor is behind a corresponding color filter, the output of the image sensor is an array of pixel values, each indicating a raw intensity of light of one of the three colors from the corresponding pixel of the image sensor. That is, since individual pixels of the image sensor is filtered to record only one of three colors, the data from each pixel does not fully determine the three colors on its own.
To obtain a full-color image, various demosaicing algorithms can be used to interpolate a set of complete red, green, and blue values for each pixel of the image sensor. For example, for a pixel that is overlaid with a green filter of the CFA, the image sensor outputs raw intensity of green light corresponding to the pixel. A demosaicing algorithm aims to interpolate pixel values of red and blue color for the pixel. Thus, a demosaicing algorithm is a digital image process used to reconstruct a full color image from incomplete color samples output from an image sensor overlaid with a CFA. The demosaicing algorithm is also referred to as de-mosaicing, demosaicking or debayering, CFA interpolation, color reconstruction, or the like. To ensure clarity and quality of the image resulting from the demosaicing algorithm, it is desirable to have an effective demosaicing algorithm.